/*
 * @Date: 2021-12-16 09:48:05
 * @LastEditors: LeeKing
 * @LastEditTime: 2021-12-23 15:15:24
 * @FilePath: \hrsaas\src\api\employees.js
 */

import request from '@/utils/request.js'

// 获取简单员工信息
export function getEmployeesListSimple() {
  return request({
    url: '/sys/user/simple'
  })
}

// 获取员工信息
export function getEmployeesList(params) {
  return request({
    url: '/sys/user/',
    params
  })
}

/**
 * 新增员工
 * @param {*} data {}
 * @returns
 */

export const addEmployees = (data) => {
  return request({
    url: '/sys/user',
    method: 'POST',
    data
  })
}

export const importEmployees = (data) =>
  request({
    url: '/sys/user/batch',
    method: 'POST',
    data
  })

/**
 * b保存员工所有信息
 *
 * @export
 * @param {*} data
 * @return {*}
 */
export function saveEmployeesInfo(data) {
  return request({
    url: '/employees/' + data.id + '/personalInfo',
    method: 'PUT',
    data
  })
}

/**
 * 获取员工岗位信息
 * @param {*} id
 * @returns
 */
export const getEmployeesJobInfo = (id) => {
  return request({
    url: `/employees/${id}/jobs`
  })
}

/**
 * 保存岗位信息
 * @param {*} data
 * @returns
 */
export const saveEmployeesJob = (data) => {
  return request({
    url: `/employees/${data.userId}/jobs`,
    method: 'PUT',
    data
  })
}
